home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 38 / Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso / -seriously_amiga- / misc / football / user / viewscheduleandresults.rexx < prev    next >
OS/2 REXX Batch file  |  1999-02-03  |  3KB  |  104 lines

  1. /* ***********************************************************************
  2.  
  3.    VIEW SCHEDULE PROGRAM FOR FOOTBALL REXX SUITE
  4.   -----------------------------------------------
  5.                    Copyright  Mark Naughton 1997
  6.  
  7.  
  8. Version    Date     History
  9. --------------------------------------------------------------------------
  10.  1.0       150997   First release.
  11.            151297   Tidied display.
  12.  
  13. **************************************************************************
  14.  
  15. Procedure
  16. ---------
  17.  
  18. 1. Check files exist.
  19. 2. Open '.df' file and get the schedule definition file. Set marker.
  20. 3. If no file specified, then exit, giving an error.
  21. 2. Open file and print all lines without '*' with the exception of
  22.    the league name, weeks and dates which are underlined.
  23. 3. Close file and exit.
  24.  
  25. ************************************************************************** */
  26. ARG league_file
  27.  
  28. version     = 1
  29. league_file = "Data/" || league_file
  30. input_file  = '.sf'
  31. input2_file = '.df'
  32. autosched   = '*AUTOSCHD='
  33. separator   = '*'
  34.  
  35.  
  36. if exists(league_file || input_file) = 0  then exit
  37. if exists(league_file || input2_file) = 0  then exit
  38.  
  39. autos = 0
  40. if open(datafile,league_file || input2_file,'r') then do
  41.    do while ~eof(datafile)
  42.       line = readln(datafile)
  43.       if pos(autosched,line) > 0 then do
  44.          autofile = delstr(line,1,10)
  45.          autos = 1
  46.       end
  47.    end
  48.    close(datafile)
  49. end
  50. else do
  51.    say
  52.    say "ERROR :    (ViewScheduleAndResults)"
  53.    say
  54.    say "Cannot open '"league_file||input2_file"' for reading."
  55.    exit
  56. end
  57.  
  58. if autos = 0 then do
  59.    say
  60.    say "ERROR :    (ViewScheduleAndResults)"
  61.    say
  62.    say "This program will only show schedule files that have"
  63.    say "created from a schedule definition file such as "
  64.    say "'Teams6.schd'. Program aborted."
  65.    say
  66.    exit
  67. end
  68.  
  69. if open(datafile,league_file || input_file,'r') then do
  70.    say
  71.    say center("Display Schedule And Results",78)
  72.    say "-------------------------------------------------------------------------------"
  73.    say
  74.    say "Created from '"autofile"' schedule defintion file."
  75.    say
  76.    do while ~eof(datafile)
  77.       line = readln(datafile)
  78.       if pos(separator,line) = 0 then
  79.          say line
  80.       else do
  81.          if words(line) > 1 then do
  82.             say subword(line,2)
  83.             uline = ''
  84.             do i=1 to length(subword(line,2))
  85.                uline = insert('-',uline,i,1)
  86.             end
  87.             say strip(uline)
  88.          end
  89.          else
  90.             if words(line) = 1 then
  91.                say
  92.       end
  93.    end
  94.    say "-------------------------------------------------------------------------------"
  95.    close(datafile)
  96. end
  97. else do
  98.    say
  99.    say "ERROR :    (ViewScheduleAndResults)"
  100.    say
  101.    say "Cannot open '"league_file||input_file"' for reading."
  102. end
  103.  
  104. exit